home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: netcom.com!smryan
- From: smryan@netcom.com (@#$%!?!)
- Subject: Re: Array initialization problem
- Message-ID: <smryanDq6L6v.Hs3@netcom.com>
- Organization: The Programmer formerly known as S M Ryan
- X-Newsreader: TIN [version 1.2 PL1]
- References: <4laukj$q4t@newsbf02.news.aol.com>
- Date: Sat, 20 Apr 1996 22:01:43 GMT
- Sender: smryan@netcom4.netcom.com
-
- : void make_matrix(int size)
- : {
- : int arr[size]; /* This is where compiler complains that size has to
- : be a constant
- : I tried casting but it did not help. */
- : }
-
- In general, for computable array bounds, use malloc,
- int *arr = malloc(size*sizeof(int));
- --
- The Queen who loves, the Queen of life, | smryan@netcom.com PO Box 1563
- the Queen who straits, the Queen of strife;| Cupertino, California
- with gasp of death or gift of breath | (xxx)xxx-xxxx 95015
- she brings the choice of birth or knife. | I don't use no smileys
-